
#ifndef __DRIVER_SPI_H
#define __DRIVER_SPI_H


#include "stdint.h"



#ifdef GD32F303_64PIN

#define SET_SPI0_NSS_HIGH          gpio_bit_set(GPIOA,GPIO_PIN_4)
#define SET_SPI0_NSS_LOW           gpio_bit_reset(GPIOA,GPIO_PIN_4)

#else 

#define SET_SPI0_NSS_HIGH          gpio_bit_set(GPIOA,GPIO_PIN_15)
#define SET_SPI0_NSS_LOW           gpio_bit_reset(GPIOA,GPIO_PIN_15)

#endif

#define SET_SPI1_NSS_HIGH          gpio_bit_set(GPIOB,GPIO_PIN_12)
#define SET_SPI1_NSS_LOW           gpio_bit_reset(GPIOB,GPIO_PIN_12)



extern void spi0_init(void);
extern uint16_t spi0_send(uint16_t data);
extern uint16_t spi1_send(uint16_t data);


#endif

